import 'package:flutter/material.dart';

void main() => runApp(CardApp());

class CardApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('卡片布局'),
        ),
        body: ListView(
          children: [
            Card(
              margin: EdgeInsets.all(12),
              child: Column(
                children: [
                  AspectRatio(
                    aspectRatio: 16 / 9,
                    // 给卡片添加圆角
                    child: ClipRRect(
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(4.0),
                          topRight: Radius.circular(4.0)),
                      child: Image.network(
                        "https://cdn.pixabay.com/photo/2019/04/08/15/08/wood-anemone-4112178__480.jpg",
                        fit: BoxFit.cover,
                      ),
                    ),
                  ),
                  ListTile(
                    title: Text(
                      'slx',
                      style: TextStyle(fontSize: 28),
                    ),
                    subtitle: Text("good boy"),
                  ),
                  ListTile(
                    title: Text('qd'),
                  ),
                  ButtonBar(
                    children: [
                      TextButton(onPressed: () {}, child: Text('Like')),
                      TextButton(onPressed: () {}, child: Text('Read')),
                    ],
                  ),
                ],
              ),
            ),
            Card(
              margin: EdgeInsets.all(12),
              child: Column(
                children: [
                  ListTile(
                    title: Text(
                      'slx111',
                      style: TextStyle(fontSize: 28),
                    ),
                    subtitle: Text("good boy1111"),
                  ),
                  ListTile(
                    title: Text('qd111'),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
